<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set value="<%=request.getContextPath()%>" var="ctx"></c:set>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="关键字台">
    <meta name="description" content="描述"> 
    <link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx}/css/animate.css" rel="stylesheet">
    <link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx}/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/plugins/toastr/toastr.min.css">
	<title>摇一摇中奖记录</title>


</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="row">
                           <div class="col-sm-12">
                                <h3>摇一摇中奖记录</h3>
                           </div>
                        </div>
                    </div>
  
	             <div class="ibox-content">
					<table class="table table-striped table-bordered table-hover dataTables-example text-center" id='tb'>
						<thead>
							<tr>
								<th class="text-center">序号</th>
								<th class="text-center">微信昵称</th>
								<th class="text-center">头像</th>
								<th class="text-center">联系人</th>
								<th class="text-center">手机号</th>
								<th class="text-center">中奖时间</th>
								<th class="text-center">奖品名称</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
				</div>
			

				</div>
			</div>
		</div>
	</div>

	
		<!-- 全局js -->
    <script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
    <script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义js -->
	<script src="${ctx}/js/plugins/toastr/toastr.min.js"></script>
	<script src="${ctx}/js/jquery.validate.min.js"></script>
	<script src="${ctx}/js/plugins/dataTables/jquery.dataTables.js"></script>
	<script src="${ctx}/js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script type="text/javascript">
	$(function() {
			var table = $('#tb').DataTable({
				"bPaginate":true,//翻页功能
				"iDisplayLength": 10,//每页显示的行数
				"bSort":false,//排序功能
				'bLengthChange': false, //是否允许用户自定义每页显示条数。
				"bProcessing": true, // 是否显示取数据时的那个等待提示
                "bServerSide": true,//这个用来指明是通过服务端来取数据
                "sAjaxSource": "${ctx}/yyy/prizesRecord",//这个是请求的地址
                "fnServerData": retrieveData, // 获取数据的处理函数
				"aoColumns": [
										{ "sClass": "center","bSearchable": true,"aTargets" : [0],
										  "mRender": function(data, type, full) {
			                                  return full.seq;} 
										},
										{ "sClass": "center", "mRender": function(data, type, full) {
					 						if(full.nickName == null){
												return '';
											}else{
												return full.nickName;
											}
										 }},
										{ "sClass": "center","mRender": function(data, type, full) {
					 						if(full.head_pic == null){
												return '';
											}else{
												return '<img alt="image" class="img-circle" src='+full.head_pic+' style="width:50px;"/>';
											}
										 }},
										{ "sClass": "center","mRender": function(data, type, full) {
											if(full.name == null){
												return '';
											}else{
												return full.name;
											}
										}},
										{ "sClass": "center","mRender": function(data, type, full) {
											if(full.mobile == null){
												return '';
											}else{
												return full.mobile;
											}
										}},
										{ "sClass": "center", "mRender": function(data, type, full) {
											if(full.createTime == null){
												return '';
											}else{
												return full.createTime;
											}		
										}},
										{ "sClass": "center", "mRender": function(data, type, full) {
											if(full.config_name_ == null){
												return '';
											}else{
												return full.config_name_;
											}
										}}
									]
			});
		
	
	});
	
	  //分页方法
    function retrieveData(sSource,aoData, fnCallback){
        var dataArr = eval("["+JSON.stringify(aoData)+"]");
        $.ajax({
            url : sSource, //这个就是请求地址对应sAjaxSource
            data : {"aoData":JSON.stringify(dataArr)},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
            type : 'post',
            dataType : 'json',
            async : false,
            success : function(result) {
                fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
            },
            error : function(msg) {
            }
        });
    }
  
</script>
</body>
</html>